import React from 'react';
import type { WidgetMaterial } from '../types/prevViewTypes';

// 同时需要修改ShapePoint组件的接口定义
interface ShapePointProps {
  position: keyof WidgetMaterial;
  item: WidgetMaterial;
  onPointClick: (pos: keyof WidgetMaterial, e: React.MouseEvent) => void;
}
// 提取形状控制点组件（复用重复代码）
const ShapePoint: React.FC<ShapePointProps> = ({ position, item, onPointClick }) => {
  return (
    <div
      className={`shape-point ${position}`}
      style={item[position] as React.CSSProperties}
      onMouseDown={(e) => {
        e.stopPropagation();
        e.preventDefault();
        onPointClick(position, e);
      }}
    ></div>
  );
};
export default ShapePoint;
